import {UnwrapNestedRefs} from "vue/dist/vue";
import {BaseApi} from "~/icesoft/utils/service/BaseApi";
import {CreateState, DetailState, EditState, TableState} from "~/icesoft/utils/service/types";

export abstract class ServiceAction<T> extends BaseApi<T> {
    beforeTable(tableState: UnwrapNestedRefs<TableState<T>>) {
    };

    beforeCreate(createState: UnwrapNestedRefs<CreateState<T>>) {
    };

    beforeEdit(editState: UnwrapNestedRefs<EditState<T>>) {
    };

    beforeDetail(detailState: UnwrapNestedRefs<DetailState<T>>) {
    };

    afterTable(tableState: UnwrapNestedRefs<TableState<T>>) {
    };

    afterCreate(createState: UnwrapNestedRefs<CreateState<T>>) {
    };

    afterEdit(editState: UnwrapNestedRefs<EditState<T>>) {
    };

    afterDetail(detailState: UnwrapNestedRefs<DetailState<T>>) {
    };

    beforeSubmit() {
    }

    afterSubmit(res: any) {
    }

    beforeDelete() {
    }

    afterDelete() {
    }
}
